import React, { Component } from 'react';
import Item from '../Item';
import './index.css';

export default class List extends Component {
    render() {
        //拿到父组件传递的任务列表
        // todos={todos} changeDone={changeDone}
        const { todos, changeDone } = this.props;
        return (
            <ul className='todo-main'>
                {
                    //todo:{ id: Date.now(), content: '抽烟', done: true },
                    todos.map((item,index) => {
                       return <Item  key={item.id} {...item} changeDone={changeDone}/>
                    })
                }
            </ul>
        )
    }
}
